import time

from reptile.WebScraper import WebScraper
from utils import LogManager


class WorkProject:
	def __init__(self, interval: int) -> None:
		self.interval = interval
		self.last_run_time = None
		self.data = []
		self.log = LogManager()
		self.scraper = WebScraper()

	def need_work(self):
		if self.last_run_time is None:
			return True
		return time.time() > self.last_run_time + self.interval

	def work(self):
		self.last_run_time = time.time()
		self.data = []

	def get_work_data(self):
		return self.data
